<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang='zh-CN' xml:lang='zh-CN' xmlns='http://www.w3.org/1999/xhtml'>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta http-equiv="Content-Language" content="zh-CN"/>
        <meta name="robots" content="index, follow" />
        <link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico" />
        <title>氿上网</title>
        {$system_css}
        {$system_js}
        <script>
            var editor;
            KindEditor.ready(function(K) {
                editor = K.create('textarea[name="content"]', {
                    resizeType : 1,
                    allowPreviewEmoticons : false,
                    allowImageUpload : false,
                    items : [
                        'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                        'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
                        'insertunorderedlist', '|', 'emoticons', 'image']
                });
            });
        </script>
        <script type="text/javascript">
            $(function(){
                $("#myform").validate({
                    rules: {
                        name:'required',
                        content:'required'
                    },
                    messages: {
                        name: "产品名称不能为空!",
                        content:'产品介绍不能为空'
                    }
                });
            })
        </script>
    </head>
    <body>
        <div id="OSC_Screen">
            {include file="header.html"}
            <div id="OSC_Content" class='CenterDiv'>
                {include file='user_nav.html'}
                {include file="message.html"}
                <div class="MainForm" id="reg_page">

                    <form id="myform" name="myform" action="{$site_url}shop/seller/goods/edit/{$data.id}" method="post" style="float:left; width:700px;" enctype="MULTIPART/FORM-DATA" >
                        <table cellspacing='0' cellpadding='0'>
                            <tr id='tr_user'>
                                <th >产品图片：</th>
                                <td>
                                    <input type="file" name="goods_images" id="goods_images" />
                                     <br/>
                                    {if $data.goods_image != ''}
                                    <img src="{$data.goods_image}" width="100" height="100" style="border: 1px solid #ccc">
                                        {/if}
                                </td>    			
                            </tr>

                            <tr id='tr_user'>
                                <th >产品名称：</th>
                                <td>
                                    <input type='text' name='name' id='name'  class='TEXT' style='width:400px;' value="{$data.name}"/>
                                </td>    			
                            </tr>

                            <tr id='tr_user'>
                                <th >支付类型：</th>
                                <td>
                                    <input type="radio" name="account_type" value="free"  id="account_0" {if $data.account_type == 'free'}checked='true'{/if}/><label for="account_0">免费</label>
                                    <input type="radio" name="account_type" value="points"  id="account_1" {if $data.account_type == 'points'}checked='true'{/if}/><label for="account_1">积分</label>
                                    <input type="radio" name="account_type" value="rmb"  id="account_2" {if $data.account_type == 'rmb'}checked='true'{/if}/><label for="account_2">RMB</label>
                                </td>    			
                            </tr>
                               <tr id='tr_user'>
                                <th >支付金额：</th>
                                <td>
                                    <input type='text' name='account' id='account'  class='TEXT' style='width:200px;' value="{$data.account}"/>
                                    *不填写为免费
                                </td>    			
                            </tr>
                            <tr id='tr_user'>
                                <th >产品分类：</th>
                                <td id="category_id">
                                    <select class='category_id' name='category_id' >
                                        {$category_option}
                                    </select>
                                </td>    			
                            </tr>

                            <tr id='tr_user'>
                                <th >是否上架：</th>
                                <td>
                                    <input type="radio" name="is_onsale" value="1" {if $data.is_onsale == '1'}checked='true'{/if} id="show_1"/><label for="show_1">是</label>
                                    <input type="radio" name="is_onsale" value="0"  id="show_0" {if $data.is_onsale == '0'}checked='true'{/if}/><label for="show_0">否</label>
                                </td>    			
                            </tr>

                            <tr id='tr_user'>
                                <th >是否推荐：</th>
                                <td>
                                    <input type="radio" name="is_recommend" value="1"  id="recommend_1" {if $data.is_recommend == '1'}checked='true'{/if}/><label for="recommend_1">是</label>
                                    <input type="radio" name="is_recommend" value="0"  id="recommend_0" {if $data.is_recommend == '0'}checked='true'{/if}/><label for="recommend_0">否</label>
                                </td>    			
                            </tr>

                            <tr id='tr_user'>
                                <th >详细介绍：</th>
                                <td>
                                    <textarea name="content" id="content" style="width:600px;height:220px;">{$data.content}</textarea>
                                </td>    			
                            </tr>
                            <tr class='buttons'>
                                <th>&nbsp;</th>		
                                <td style='padding:20px 0;'>
                                    <input type='submit' value=' 更改 ' class='BUTTON SUBMIT'/><br/><br/>
                                </td>
                            </tr>
                        </table>
                    </form>
                    <div class='clear'></div>
                </div>

            </div>
            <div class='clear'></div></div>
        <div class='clear'></div>
        {include file="footer.html"}
        </div>

        <script>
            
//            $(function(){
//                var category_id = $('.category_id').val();
//                if(category_id != ''){
//                    $.ajax({
//                        url:"{$site_url}admin/ajax/category_sub",
//                        type:'post',
//                        dataType:'html',
//                        data:'id='+category_id,
//                        success:function(data){
//                            if(data != ''){
//                                var html = "<select class='category_id' name='category_id[]' onchange='change_category(this)'><option value='0'>==不选择==</option>";
//                                html +=data+"</select>";
//                                $('#category_id').append(html);
//                            } else{
//                                $(this).next('.category_id').remove();
//                            }
//                        }
//                    });
//                }
//                
//                $('.category_id').change(function(){
//                    $(this).next('.category_id').remove();
//                })
//            });
//            
            
//            function change_category(category_sub){
//                $('.category_id').change(function(){
//                    $(this).next('.category_id').remove();
//                })
//                $.ajax({
//                    url:"{$site_url}admin/ajax/category_sub",
//                    type:'post',
//                    dataType:'html',
//                    data:'id='+category_sub.value,
//                    success:function(data){
//                        if(data != ''){
//                            var html = "<select class='category_id' name='category_id[]' onchange='change_category(this)'><option value='0'>==不选择==</option>";
//                            html +=data+"</select>";
//                            $('#category_id').append(html);
//                        } else{
//                            $(this).next('.category_id').remove();
//                        }
//                    }
//                });
//            }
        </script>
    </body>
</html>
